package com.jm.weibo.logic;


import java.util.ArrayList;
import java.util.List;

import org.apache.commons.httpclient.methods.GetMethod;

import com.jm.weibo.ui.R;

import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 表情图片适配器
 * @author Administrator
 *
 */
public class ImageFaceAdapter extends BaseAdapter{
    
	// 定义Context
	private Context	mContext;
	
	private LayoutInflater layoutInflater;
	//定义图片源
	private List<Integer> mImageIds = new ArrayList<Integer>();
	
	public  ImageFaceAdapter(Context context){
		this.mContext = context;
		this.layoutInflater = LayoutInflater.from(context);
		this.initMImageIds();
	}
	
	/**
	 * 初始化图片源
	 */
	private void initMImageIds() {
	  for (int i = 0; i <= 289; i++) {
         this.mImageIds.add(R.drawable.face1 + i);
      }
    }

	
//	public static int getMImageIds(int postion){
//		
//	}
	@Override
	public int getCount() {
		return this.mImageIds.size();
	}

	@Override
	public Object getItem(int location) {
		return this.mImageIds.get(location);
	}

	@Override
	public long getItemId(int position) {
		 
		return position;
	}
    
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = layoutInflater.inflate(R.layout.gv_item, null);
		ImageView iv = (ImageView) view.findViewById(R.id.gvItemIcon);
		iv.setImageResource(this.mImageIds.get(position));
		
		return view;
	}
   
	
}
